package com.zhang.zhangapp.bean.location;

import android.os.Parcel;
import android.os.Parcelable;

import org.xutils.db.annotation.Column;
import org.xutils.db.annotation.Table;

/**
 * Created by Administrator on 2018/4/12.
 */
@Table(name = "china_city")
public class City implements Parcelable{

    @Column(name = "clat")
    private String clat;
    @Column(name = "initial")
    private String initial;
    @Column(name = "clon")
    private String clon;
    @Column(name = "name")
    private String name;
    @Column(name = "py")
    private String py;
    @Column(name = "code", isId = true)
    private String code;
    @Column(name = "flag")
    private String flag;


    public City() {
        super();
    }

    public City(String clat, String initial, String clon, String name, String py, String code, String flag) {
        this.clat = clat;
        this.initial = initial;
        this.clon = clon;
        this.name = name;
        this.py = py;
        this.code = code;
        this.flag = flag;
    }

    public String getClat() {
        return clat;
    }

    public void setClat(String clat) {
        this.clat = clat;
    }

    public String getInitial() {
        return initial;
    }

    public void setInitial(String initial) {
        this.initial = initial;
    }

    public String getClon() {
        return clon;
    }

    public double getDoubleClon(){
        try {
            return Double.valueOf(clon);
        }catch (Exception e){

        }
        return 0;
    }

    public double getDoubleClat(){
        try {
            return Double.valueOf(clat);
        }catch (Exception e){

        }
        return 0;
    }

    public void setClon(String clon) {
        this.clon = clon;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPy() {
        return py;
    }

    public void setPy(String py) {
        this.py = py;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getFlag() {
        return flag;
    }

    public void setFlag(String flag) {
        this.flag = flag;
    }

    protected City(Parcel in) {
        clat = in.readString();
        initial = in.readString();
        clon = in.readString();
        name = in.readString();
        py = in.readString();
        code = in.readString();
        flag = in.readString();
    }

    public static final Creator<City> CREATOR = new Creator<City>() {
        @Override
        public City createFromParcel(Parcel in) {
            return new City(in);
        }

        @Override
        public City[] newArray(int size) {
            return new City[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeString(clat);
        parcel.writeString(initial);
        parcel.writeString(clon);
        parcel.writeString(name);
        parcel.writeString(py);
        parcel.writeString(code);
        parcel.writeString(flag);
    }
}
